package proxy

import "net/http"

// Proxy is
type Proxy struct {
}

// Handler http request
func (p Proxy) Handler(w http.ResponseWriter, r *http.Request) {

}

// ResponseWriter is a proxy to http.ResponseWriter
type ResponseWriter struct {
	writer  http.ResponseWriter
	Context []byte
}

// NewResponseWriter is
func NewResponseWriter(w http.ResponseWriter) *ResponseWriter {
	return &ResponseWriter{
		writer:  w,
		Context: []byte{},
	}
}

func (resp *ResponseWriter) Header() http.Header {
	return resp.writer.Header()
}

func (resp *ResponseWriter) Write(bytes []byte) (int, error) {
	resp.Context = append(resp.Context, bytes[0:len(bytes)]...)

	return resp.writer.Write(bytes)
}

func (resp *ResponseWriter) WriteHeader(code int) {
	resp.writer.WriteHeader(code)
}
